package com.feishi.core.util.common;

import java.util.Arrays;

/**
 * Created by caixq on 3/13 013.
 */
public class ArrayUtil {
    public static boolean isEmpty(Object[] array) {
        return (array == null || array.length == 0);
    }
    public static int[] randomIndex(int size){
        int[] out=getInts(size);
        int tmp=0,index;
        for (int i = size-1; i >=0; i--) {
            tmp=out[i];
            index= (int) (Math.random()*(i+1));
            out[i]=out[index];
            out[index]=tmp;
        }

        return out;
    }
    public static int[] getInts(int size){
        int[] out=new int[size];
        for (int i = 1; i <size ; i++) {
            out[i]=i;
        }
        return out;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(randomIndex(154)));
    }
}
